|
|
|
| |
|
|
|
|
The values used to initialize the variables are related to the ODBC data source you defined in the "Registering an ODBC Data Source" section of this chapter. If you have not completed the first part of this chapter, you cannot run this program with these variables. |
|
|
|
|
|
|
|
|
|
|
Now add the following lines to the Form_Load event of the form: |
|
|
|
|
|
|
|
|
Private Sub Form_Load()
'
' startup connection
'
StartDB
'
End Sub |
|
|
|
|
|
|
|
|
You need to add the code that handles all the user actions behind the cmdMove command button array. This button array handles the navigation chores (First, Last, Next, and Back). Enter the code in Listing 19.25 into the Click event of the cmdMove button. |
|
|
|
|
|
|
|
|
Listing 19.25. Coding the cmdMove_Click event. |
|
|
|
|
|
|
|
|
Private Sub cmdMove_Click(Index As Integer)
'
' move record pointer
'
Select Case Index
Case 0 '
objSQL.MoveFirst Me
Case 1
objSQL.MovePrevious Me
Case 2
objSQL.MoveNext Me
Case 3
objSQL.MoveLast Me
End Select
'
End Sub |
|
|
|
|
|
|
|
|
Finally, you need to code the Click event of the cmdAction button. This handles the record-modification chores (Add, Update, Delete, and Refresh). Add the code in Listing 19.26 to the project. |
|
|
|
|
|